package com.lw.function;

import java.util.Comparator;
import java.util.function.BiFunction;
import java.util.function.BinaryOperator;

/**
 * @author Administrator
 * @version 1.0
 * @description:
 * @date 2022/4/25 22:09
 */
public class TestBinaryOperator {
    public static void main(String[] args) {
        BiFunction<String,String,String> biFunction=(s1,s2)->s1+s2;
        System.err.println(biFunction.apply("zhangsan", "lisi"));

        BinaryOperator<String> binaryOperator=(s1,s2)->s1+s2;
        System.err.println(binaryOperator.apply("canshu1", "canshu2"));

        //创建一个比较器
        Comparator<String> comparator=(first,second)->first.compareTo(second);

        System.err.println(BinaryOperator.minBy(comparator).apply("zhangsan", "lisi"));

        System.err.println(BinaryOperator.maxBy(comparator).apply("zhangsan", "lisi"));

    }
}
